import React,{Suspense} from 'react';
import {BrowserRouter as Router , Route} from 'react-router-dom'
import {Provider} from 'react-redux'
import store from './redux/store'
import routers from './config/routers'
import './App.css'
export default function App(){
    return(
        //suspense是用于配合懒加载使用，
        //fallback属性的值就是加载组件的空白过程，要渲染的视图，可以渲染任务数据类型：文本，jsx，组件
        <Provider store={store}>
            <Suspense fallback={<div style={{color:'pink',fontSize:20}}>加载中</div>}>
                <Router>
                    {routers.map(item=>{
                        return <Route key={item.path} path={item.path}component={item.component} exact={item.exact}></Route>
                    })}
                </Router>
            </Suspense>
        </Provider>
    )
}